﻿namespace Behemoth.SharePoint.Logging.EventExample {

  using Behemoth.SharePoint.Logging;

  // TODO turn this into a unit test class

  /// <summary>
  /// An example of one way you can consume these methods without a lot of code.
  /// </summary>
  public class ExampleLibraryClass : LoggingEventConsumerBase {

    protected override string LOGGING_PRODUCT {
      get { return "Behemoth"; }
    }
    protected override string LOGGING_CATEGORY {
      get { return "Logging Example"; }
    }

  }

  /// <summary>
  /// Put this code into the class that creates your objects that have logging events
  /// </summary>
  public class ExampleLoggingEvent_CallingClass {

    /// <summary>
    /// Put this object in the class that creates the log and then
    /// calls your class that logs data via events.
    /// </summary>
    private static BehemothLoggingService uls = new BehemothLoggingService();
    // TODO Set default properties, if desired in your constructor, but events can have their own
    //uls.DefaultCategory = "";
    //uls.DefaultProduct = "";

    /// <summary>
    /// Put this code in the class that creates the log and then
    /// calls your class that logs data via events.
    /// </summary>
    public static void Main() {
      // don't instantiate the library class if it's a static one...
      LoggingEventConsumerBase library = new ExampleLibraryClass();
      library.Logging += new LoggingEventHandler(uls.Log);
      // ... Do some stuff
    }

  } // class
} //namespace
